//fibonacci数列
function fibonacci(n) {
    //1 1 2 3 5 8 ...
    // f(n) = f(n - 1) + f(n - 2)
    return n <= 2 ? 1 : fibonacci(n - 1) + fibonacci(n - 2);
}

var onmessage = function (event) {
    var num = event.data;
    console.log("分线程接收到主线程发送的数据 = " + num);
    var result = fibonacci(num);
    postMessage(result);
    console.log("分线程向主线程返回的数据 = " + result);

}